When to use std::vector vs. std::vector

Char s signedness depends on the compiler 1 It can represent a unsigned char or signed char Which type is used when representing a string is dependent on the compiler - therefore you should use char for portability, and clarity. If that isn't enough, would the less typing needed when writing char convince you? :) Again, the compiler thinks string s are of type char which can be equivalent to unsigned char or signed char If you're going to be working with string s use std::vector.

Char's signedness depends on the compiler.1 It can represent a unsigned char or signed char. Which type is used when representing a string is dependent on the compiler - therefore you should use char for portability, and clarity. If that isn't enough, would the less typing needed when writing char convince you?

:) Again, the compiler thinks strings are of type char *, which can be equivalent to unsigned char * or signed char *. If you're going to be working with strings use std::vector. 1 char is the only type with this behavior.

References 1 char is signed or unsigned by default.

Char is more compatible with strings than unsigned char. String literals are char and std::string is actually std::basic_string.

I am not disputing your answer I just want to get a better understanding – karimjee Sep 9 at 2:17 @karimjee : std::string is a typedef for std::basic_string; std::basic_string relies on std::char_traits, but std::char_traits is only specialized for char and wchar_t. So, std::basic_string will not portably play nice with unsigned char out of the box (though in practice, it will work just fine with most modern compilers). – ildjarn Sep 9 at 2:27 @ildjarn: you posted the best answer to the OP's original question – J T Sep 9 at 2:54.

Both are equally well suited. If these are character buffers, as opposed to bytes, I would go with std::vector. You can create a string from a vector of any of those types with std::string( v.begin(), b.end() ).

Char, unsigned char, and signed char are 3 distinct types. Use an unsigned char or a signed char when dealing with numbers. Use a regular char when dealing with strings.

Thus, you should use a char.

Talking about strings, you should be careful if someday, you want to have strings which contain anything else than plain english! joelonsoftware.com/articles/Unicode.html.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.